<?php

use think\facade\Route;

/* 账户余额 */
Route::group('balance', function () {

    Route::get('$', '@basic');
    Route::post('order$', '@rechargeOrder');
    Route::get('flow$', '@flow');
    Route::get('pwd', '@pwdStat');
    Route::post('pwd', '@setPwd');
    Route::post('pwd/verify', '@pwdVerify');
    Route::post('pwd/before', '@pwdBefore');
    Route::put('pwd', '@updatePwd');

    Route::post('applepay/<order_no>/order', '@iosRechargeVerify');

})->prefix('\app\user\service\user\Balance');

/* 账户余额 -后台 */
Route::group('admin/balance', function () {
    Route::put('<user_id>/set', '@setBalance');
})
    ->prefix('\app\user\service\user\admin\Balance')
    ->middleware('adminRoute');

/* 账户收入 */
Route::group('income', function () {
    Route::get('$', '@basic');  // 推广收入基础信息
    Route::get('flow$', '@flow');   // 推广收入明细
    Route::get('course$', '@courseIncome');   // 推广课程带来的收益
    Route::get('user$', '@userIncome');     // 推广用户带来的收益
    Route::group('encashment', function () {
        Route::post('balance$', '@toBalance');
        Route::post('wxpay$', '@toWxpay');
        Route::get('wxpay/check$', '@toWxpayPcCheck');
        Route::post('alipay$', '@toAlipay');
    })->middleware(['phoneCheck']);
})->prefix('\app\user\service\user\Income');

/* 账户收入 - 提现到微信 - 获取openid */
Route::get('income/encashment/wxpay/openid$', '@toWxpayPcOpenid')
->prefix('\app\user\service\user\Income')
->middleware(['withoutLogin']);

/* 账户积分 */
Route::group('credit', function () {
    Route::get('$', '@infoAndIncrease');
    Route::get('flow$', '@flow');
    Route::post('$', '@recharge');
    Route::get('base', '@base');
    Route::post('signIn', '@signIn');
})->prefix('\app\user\service\user\Credit');

/* 账户积分-后台 */
Route::group('admin/credit', function () {
    Route::put('<user_id>/set', '@setCredit');
})
    ->prefix('\app\user\service\user\admin\Credit')
    ->middleware('adminRoute');

/* 会员 */
Route::group('vip', function () {
    Route::get('$', '@basic');
    Route::post('$', '@buy');
    Route::get('log$', '@log');
})->prefix('\app\user\service\user\Vip');

/* 后台会员 */
Route::group('admin/vip', function () {
    Route::get('$', '@vipType');
})->prefix('\app\user\service\user\admin\Vip');

